<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<form id="search_form" method="post" style="padding-top:1px">
    <table class="editTable">
        <tr>
            <td class="label">项目编号</td>
            <td>
                <input type="text" name="projectcode"  class="inputp" data-options="required:false" style="width: 211px">
            </td>
        </tr>
        <tr>
            <td class="label">所属单位</td>
            <td>
                <input type="text" name="factoryname"  class="inputp" data-options="required:false" style="width: 211px">
            </td>
        </tr>
        <tr>
            <td class="label">巡视单位</td>
            <td>
                <input type="text" name="routername"  class="inputp" data-options="required:false" style="width: 211px">
            </td>
        </tr>
        <tr>
            <td class="label">运维类型</td>
            <td>
                <select name="tasktype" id="tasktype" style="width: 232px;height: 32px;" class="selectp">
                </select>
            </td>
        </tr>
        <tr>
            <td class="label">开始时间</td>
            <td>
                <input type="text" id="form-starttime" name="starttime"  class="inputp" data-options="required:false" style="width: 211px">
            </td>
        </tr>
        <tr>
            <td class="label">结束时间</td>
            <td>
                <input type="text" id="form-endtime" name="endtime"  class="inputp" data-options="required:false" style="width: 211px">
            </td>
        </tr>
    </table>
</form>
<script>
    $(function () {
        //日期样式
        $('#form-starttime').datebox({
            formatter: function (date) {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                var d = date.getDate();
                return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
            }
        });
        //日期样式
        $('#form-endtime').datebox({
            formatter: function (date) {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                var d = date.getDate();
                return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
            }
        });
        $(".combo-text").removeAttr("style");
        $(".combo-text").attr("style", "width:211px;height:32px;line-height:24px");
        $(".combo-text").addClass("selectp");
        $(".combo-arrow").attr("style", "margin-left: -20px;margin-top: 3px;background-color:rgba(0,0,0,0)");
        $(".combo-panel").attr("style", "margin-top:0px;");

        //运维类型
        $.ajax({
            type:'get',
            url:'/sys/groupsParam',
            data:{
                groups:'运维类型'
            },
            cache:false,
            dataType:'json',
            success:function(response){
                if(response.code == '200'){
                    secondDatas = response.result;
                    //遍历回传的数据添加到二级select
                    $("#tasktype").append("<option value=''>请选择</option>");
                    $.each(secondDatas, function(key, secondData) {
                        var option = '<option value="'+secondData.value+'">'+secondData.title+'</option>';
                        $("#tasktype").append(option);
                    });
                    //二级select展示
                    $("#tasktype").fadeIn("slow");
                }
            },
            error:function(){
                alert("请求失败")
            }
        });
    });
</script>
</html>